<#assign ctx = request.contextPath />
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录页</title>
		<link rel="stylesheet" href="${ctx}/css/common.css" />
		<link rel="stylesheet" href="${ctx}/css/login.css" />
		<script type="text/javascript" src="${ctx}/js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="${ctx}/js/common.js" ></script>
		<script type="text/javascript" src="${ctx}/js/login.js" ></script>
			<script type="text/javascript">
		/** 监听文档加载完事件 */
		$(function(){


			/*为图片绑定点击事件:随机验证码 */
			$("#vimg").click(function(){
				var num = Math.random();
				console.log("num:"+num);
				$(this).attr("src","${ctx}/tocode?"+num);
			})
			/*为刷新按钮绑定点击事件:随机验证码*/
			$("a[class='transform']").click(function(){
				$("#vimg").trigger("click");
			})

			/** 为表单绑定onsubmit提交事件 */
			$("form[class='fr1']").submit(function(){
				/** 做表单输入校验 */
				var userId = $("#userId");
				var pwd = $("#pwd");
				var code = $("#code");
				
				var tip = "";
				if ($.trim(userId.val()) == ""){
					tip = "账号不能为空！";
					userId.focus();// 调用文本框获取焦点方法
				}else if (!/^\w{5,20}$/.test($.trim(userId.val()))){
					tip = "账号格式不正确！";
					userId.focus();// 调用文本框获取焦点方法
				}else if ($.trim(pwd.val()) == ""){
					tip = "密码不能为空！";
					pwd.focus();// 调用文本框获取焦点方法
				}else if (!/^\w{6,20}$/.test($.trim(pwd.val()))){
					tip = "密码格式不正确！";
					pwd.focus();// 调用文本框获取焦点方法
				}else if ($.trim(code.val()) == ""){
					tip = "验证码不能为空！";
					code.focus();// 调用文本框获取焦点方法
				}else if (!/^[a-zA-Z0-9]{4}$/.test($.trim(code.val()))){
					tip = "验证码格式不正确！";
					code.focus();// 调用文本框获取焦点方法
				}
				/** 判断表单是否通过校验 */
				if (tip == ""){
					
					
					//发送ajax登录请求
					$.post("userLogin",
							{"userId":userId.val(),"pwd":pwd.val(),"code":code.val(),},
					   function(data){
					    if(data.status == "success"){
					    	//登录成功，跳转到主页
					    	location.href="${ctx}/customer/home";
					    }else if(data.status == "fail"){
					    	//提示
					    	alert(data.tip);
					    }else{
					    	alert("网络错误!");
					    }
					   }); 
					return false;
					/* return true; 提交表单，开始访问form表单中action属性中的url地址*/
				}else{
					alert(tip);
					return false;
				}
			});
		});
	</script>
		
	</head>
	<body onload="return getStorage()">
		<div id="header">
			<div class="container clear">
				<div class="logo">
					<a href="${ctx}/index.html"><img src="${ctx}/images/register02.png" alt="register02" /></a>
				</div>
				<div class="left">
					<img src="${ctx}/images/register.png" alt="register" />
					<span>我想对“登录”提意见</span>
				</div>
			</div>
		</div>
		<div id="content">
			<div class="banner">
				<img src="${ctx}/images/login01.jpg"/>
				<div class="contanier">
					<div class="smal">
						<div class="small_top">
							<img src="${ctx}/images/login02.jpg"/>
							
							<span>扫码登录更安全</span>
							<img src="${ctx}/images/login04.jpg" alt="login04" />
							<h2>用户登录 <a href="${ctx}/register.html">免费注册</a></h2>
						</div>
						<form  class="fr1">
							<label for="user">
								<span><img src="${ctx}/images/login01.png"/></span>
								<input type="text" name="userId" id="userId" placeholder="会员名/邮箱/手机号" value=""/>
								<strong class="user"></strong>
							</label>
							<label for="password">
								<span><img src="${ctx}/images/login02.png"/></span>
								<input type="password" name="pwd" id="pwd" placeholder="密码" value=""/>
								<strong class="password"></strong>
							</label>
							
							<label class="f-999999" style="">验证码：
							<input type="text" id="code" name="code"/></label>
							<img src="${ctx}/tocode" id="vimg" alt="验证码"/><a href="javascript: void(0)" class="transform"></a>
							
							
							
							<label for="">
								<a href="javascript:;"><img src="${ctx}/images/shop_car01.png" alt="0" id="check" onclick="isLoginImg(this)"/><span id="autoCheck">自动登录</span></a>
								<a href="#">忘记密码？</a>
							</label>
							<button type="submit">登录</button>
							<p>更多合作网站账号登录</p>
							<a href="javascript:;"><img src="${ctx}/images/login07.jpg" alt="login07" /></a>
							<a href="javascript:;"><img src="${ctx}/images/login08.jpg" alt="login08" /></a>
							<a href="javascript:;"><img src="${ctx}/images/login09.jpg" alt="login09" /></a>
							<a href="javascript:void(0);" data-id="0" id="more">更多合作<span>&or;</span></a>
							<ul>
								<li><a href="javascript:;"><img src="${ctx}/images/login07.jpg" alt="login07" /></a></li>
								<li><a href="javascript:;"><img src="${ctx}/images/login08.jpg" alt="login08" /></a></li>
								<li><a href="javascript:;"><img src="${ctx}/images/login09.jpg" alt="login09" /></a></li>
							</ul>
						</form>
					</div>
				</div>
				
			</div>
		</div>
		
		<div id="footer">
			<div class="bottom">
				<div class="container">
					<p><a href="#">关于约翰娜</a>&nbsp;<a href="#">帮助中心</a>&nbsp;<a href="#">开放平台</a>&nbsp;<a href="#">诚聘英才</a>&nbsp;<a href="#">联系我们</a>
						&nbsp;<a href="#">网站合作</a>&nbsp;<a href="#">法律声明及&nbsp;隐私权政策</a>&nbsp;<a href="#">知识产权</a>&nbsp;<a href="#">廉正举报</a>
						<span>© 2006-2018yuehanna.COM 版权所有</span>
					</p>
					<p><span>营业执照注册号：33010600033688</span><small></small><span>网络文化经营许可证：浙网文（2016）0380-396号 </span><small></small><span>增值电信业务经营许可证：浙B6-30110350</span>
						<small></small><span>安全责任书  </span><small></small><span>浙公网安备 33010603302328号</span>
					</p>
				</div>	
			</div> 
		</div>
	</body>
</html>
